package com.zzc.dao;

import com.zzc.bean.Dining;
import com.google.gson.Gson;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

public class DiningDao extends BaseDao{
	public void alterCourse() {

	}
	public List<Dining> getAll(){
		String hql = "FROM Dining";//hql = "FROM Dining";
		List<Dining> list_cours =getSession().createQuery(hql).list();
		String string3=new Gson().toJson(list_cours);

		System.out.println(string3);
		return list_cours;
	}
	public List<Dining> get_courseName(String courseName) {
		String hql = "FROM Dining course WHERE course.name=?";
		Query query = getSession().createQuery(hql).setString(0, courseName);
		List<Dining> list_cours =  query.list();
		//System.out.println(employee.getDepartment().getClass().getName());
		String string=new Gson().toJson(list_cours);
		System.out.println(string);
		return list_cours;
	}
}
